package com.wmeimob.fastboot.jiubei.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;


/**
 * ShopOrders.java
 * http://www.wmeimob.com
 * Copyright © 2018 wmeimob All Rights Reserved,version 1.0
 *
 * @author：wjt Mon Aug 31 23:57:11 CST 2020 Created
 */

@Table(name = "`shop_orders`")
@NoArgsConstructor
@AllArgsConstructor
@Builder
@Data
public class ShopOrders implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    /**
     * 订单编号
     */
    @Column(name = "order_no")
    private String orderNo;
    /**
     * 会员ID
     */
    @Column(name = "user_id")
    private Long userId;
    /**
     * 会员名称
     */
    @Column(name = "user_name")
    private String userName;
    /**
     * 会员编号
     */
    @Column(name = "user_code")
    private String userCode;
    /**
     * 订单类型(SHOP:商城 INTEGRAL：积分商城)
     */
    @Column(name = "order_type")
    private String orderType;
    /**
     * 会员手机号
     */
    @Column(name = "mobile")
    private String mobile;
    /**
     * 订单状态 TRADE：待付款 DELIVERED:待发货 SEND:待收货 DEAL_DONE:已成交 CANCEL:已取消 REFUND_APPLY退款申请 REFUND_SUCCESS 已退款 REFUND_REFUSE 已拒绝 COMMENT待评价
     */
    @Column(name = "order_status")
    private String orderStatus;
    /**
     * 收货人
     */
    @Column(name = "shipping_name")
    private String shippingName;
    /**
     * 收件人省份
     */
    @Column(name = "shipping_province")
    private String shippingProvince;
    /**
     * 收件人市
     */
    @Column(name = "shipping_city")
    private String shippingCity;
    /**
     * 收件人区
     */
    @Column(name = "shipping_district")
    private String shippingDistrict;
    /**
     * 收件人详细地址
     */
    @Column(name = "shipping_address")
    private String shippingAddress;
    /**
     * 收货人电话
     */
    @Column(name = "shipping_mobile")
    private String shippingMobile;
    /**
     * 运费
     */
    @Column(name = "shipping_fee")
    private BigDecimal shippingFee;
    /**
     * 微信支付交易流水号
     */
    @Column(name = "transaction_id")
    private String transactionId;
    /**
     * 订单金额
     */
    @Column(name = "order_amount")
    private BigDecimal orderAmount;
    /**
     * 实际支付金额
     */
    @Column(name = "pay_amount")
    private BigDecimal payAmount;
    /**
     * 运费抵扣
     */
    @Column(name = "shipping_deduction")
    private BigDecimal shippingDeduction;
    /**
     * 支付时间
     */
    @Column(name = "pay_at")
    @JsonFormat(locale = "zh", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date payAt;
    /**
     * 支付类型: 1微信支付 2支付宝支付
     */
    @Column(name = "pay_type")
    private Integer payType;
    /**
     * 备注
     */
    @Column(name = "remark")
    private String remark;
    /**
     * 买家留言
     */
    @Column(name = "user_comments")
    private String userComments;
    /**
     * 物流公司
     */
    @Column(name = "shipping_vendor")
    private String shippingVendor;
    /**
     * 发货单号
     */
    @Column(name = "shipping_no")
    private String shippingNo;
    /**
     * 发货时间
     */
    @Column(name = "shipping_at")
    @JsonFormat(locale = "zh", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date shippingAt;
    /**
     * 确认收货时间
     */
    @Column(name = "receipt_at")
    @JsonFormat(locale = "zh", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date receiptAt;
    /**
     * 评价时间
     */
    @Column(name = "comment_at")
    @JsonFormat(locale = "zh", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date commentAt;
    /**
     * 关闭时间
     */
    @Column(name = "closed_at")
    @JsonFormat(locale = "zh", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date closedAt;
    /**
     * 关闭原因
     */
    @Column(name = "closed_reason")
    private String closedReason;
    /**
     * 线下支付是否通过
     */
    @Column(name = "is_settle_commission")
    private Boolean settleCommission;
    /**
     * 是否评价
     */
    @Column(name = "is_comment")
    private Boolean comment;
    /**
     * GmtCreate
     */
    @Column(name = "gmt_create")
    @JsonFormat(locale = "zh", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtCreate;
    /**
     * GmtModified
     */
    @Column(name = "gmt_modified")
    @JsonFormat(locale = "zh", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtModified;
    /**
     * 是否删除
     */
    @Column(name = "is_del")
    private Boolean del;
    /**
     * 是否申请退款
     */
    @Column(name = "is_refund")
    private Boolean refund;
    /**
     * 微信流水号
     */
    @Column(name = "order_trade_no")
    private String orderTradeNo;

    @Transient
    private List<ShopOrderItems> items;

    @Transient
    private String goodsName;
    @Transient
    private String queryData;
    @Transient
    private String goodsSkuNo;
    @Transient
    private Date beginDate;
    @Transient
    private Date endDate;
    @Transient
    private Integer userAddressId;
}